﻿@{
    ViewBag.Title = "修改系统功能";
    Layout = "~/Views/Shared/_JuiLayout.cshtml";

    Dictionary<string, object> dic_M = Model;
    
    
}
@section header {}
<div id="layout" class="noNavTab">
    <div id="navTab">
        <h2 class="contentTitle">
            修改系统功能</h2>
        <div class="pageContent">
            @{  
                int id = Utils.StrToInt(ViewData["id"], 0);
                string rturl = "/SysMenu/List?menu=SysFunctions&name=list&hostId=" + dic_M["MenuId"];
                using (Html.BeginForm("Edit", "OperateTotal", new { id = id, dtnum = (int)Database.Default, name = DencryptHelper.Encrypt("Sys_IBFunctions"), url = rturl }, FormMethod.Post, new { @id = "subForm", @class = "pageForm required-validate", onsubmit = "return validateCallback(this,navTabAjaxDone)" }))
                {
                
                <div class="pageFormContent nowrap">
                    <dl>
                        <dt>编码：</dt>
                        <dd>
                            @Html.TextBox("t0_No", dic_M["No"], new { @class = " textInput", maxlength = "100" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>名称：</dt>
                        <dd>
                            @Html.TextBox("t0_Name", dic_M["Name"], new { @class = "required textInput", maxlength = "100" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>描述：</dt>
                        <dd>
                            @Html.TextArea("t0_Description", dic_M["Description"].ToString(), new { @class = "required textInput", rows = "5", cols = "80", maxlength = "100" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>URL：</dt>
                        <dd>
                            @Html.TextBox("t0_Url", dic_M["Url"], new { @class = " textInput", maxlength = "100" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>Controller名称：</dt>
                        <dd>@Html.TextBox("t0_ControllerName", dic_M["ControllerName"], new { @class = " textInput", maxlength = "100" })</dd>
                    </dl>
                    <dl>
                        <dt>Action名称：</dt>
                        <dd>@Html.TextBox("t0_ActionName", dic_M["ActionName"], new { @class = " textInput", maxlength = "100" })</dd>
                    </dl>
                    <dl>
                        <dt>序号：</dt>
                        <dd>
                            @Html.TextBox("t0_SortOrder", dic_M["SortOrder"], new { @class = "digits required textInput", maxlength = "100" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>操作：</dt>
                        <dd>
                            <span id="show" class=""></span>
                        </dd>
                    </dl>
                    <dl>
                        <dt>&nbsp</dt>
                        <dd>
                            @Html.TextBox("num", "", new { @class = "digits  textInput", maxlength = "100" })
                            @Html.TextBox("fun", "", new { @class = " textInput", maxlength = "100" })
                            <input type="button" value="添加" id="btnAdd" onclick='add()' />
                            @Html.Hidden("t0_Operations", dic_M["Operations"]);
                        </dd>
                    </dl>
                    <dl>
                        <dt>&nbsp</dt>
                        <dd>
                            <div class="buttonActive">
                                <div class="buttonContent">
                                    <button type="submit">
                                        修改</button></div>
                            </div>
                        </dd>
                        <dd>
                            <a class="button" href='@rturl'><span>返回</span></a></dd>
                    </dl>
                </div>
                    }
                } 
            
        </div>
    </div>
</div>

<link href="../../content/jui-normal.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/Scripts/pager.js"></script>
<script type="text/javascript">
    var sum = 0, dic = {};
    $(function () {
        var st = '@Model["MenuId"].ToString()', su = '-1';

        var operations = '@Model["Operations"].ToString()';
        $.each(operations.split(','), function (k, v) {
            if (v != '') {
                dic[k] = v;
                $('#show').append("<span id=" + k + "><em>" + v + "</em> -- <a onclick='del(\"" + k + "\")'>X</a></span>");
            }
        });
    });

    function add() {
        var num = $('#num').val(), fun = $('#fun').val();
        if (isNaN(parseInt(num, 10))) {
            return;
        }
        if (num >=0 && fun != '') {
            $('#num').val('');
            $('#fun').val('');
            var id = "sp_" + sum;
            dic[id] = num + "=" + fun;
            oper();
            $('#show').append("<span id=" + id + "><em>" + dic[id] + "</em> -- <a onclick='del(\"" + id + "\")'>X</a></span>");
            sum++;
        }
    }
    function isnum(num) { return /^(\\\\-?)(\\\\d+)$/.test(num) }
    function del(d) {
        $('#' + d).remove();
        dic[d] = "";
        oper();
    }
    function oper() {
        var opera = "";
        $.each(dic, function (k, v) {
            if (v != "") {
                opera = opera + v + ",";
            }
        });
        $('#t0_Operations').val(opera);
    }
</script>
